
#ifndef _DYNAMIC_ARR_
#define _DYNAMIC_ARR_

#ifndef dynamic_arr_type
	#define dynamic_arr_type double
	#define dynamic_arr_type_scan_format "%lf"
#endif

#include "../common/error.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>

typedef struct dynamic_arr
{
	int capacity;
	int count;
	dynamic_arr_type* values;
} dynamic_arr;

dynamic_arr* dynamic_arr__allocate();
void dynamic_arr__grow(dynamic_arr* arr);
void dynamic_arr__add(dynamic_arr* arr, dynamic_arr_type value);
void dynamic_arr__read_from_stream(dynamic_arr* arr, FILE* stream);
void dynamic_arr__read_from_file(dynamic_arr* arr, const char* filename);
dynamic_arr* dynamic_arr__create_from_file(const char* filename);
void dynamic_arr__free(dynamic_arr* arr);

#endif /*  _DYNAMIC_ARR_ */

